<template>
    <div class="Main">
       <div class="banner">
        <img  :src="pic7" alt="">
       </div>
       <div class="nav">
           <span @click="jiupin">正在抢购</span>
           <span @click="xinpin">上新预告</span>
       </div>
       <div class="content">
           <div class="good" v-for="(item,index) in list3" :key="index">
               <div class="tu">
                <img :src="item.picture" alt="">
               </div>
               <div class="right">
                <div class="id">汉堡王| 北美新天地餐厅</div>
                <div class="desc">{{item.name}}</div>
                <div class="bao">爆爆拼团</div>
                <div class="price">
                  <div class="key">
                    <div class="one">{{item.min_price}}</div>
                      <div class="two">{{item.promotion_info ? item.promotion_info : '无折扣'}}</div>
                  </div>
                  <div class="three" @click="masq">{{zt}}</div>
                </div>
                <div class="money">
                  <div class="yi">{{item.min_price}}</div>
                  <div class="er">月售{{item.month_saled_content}}份</div>
                </div>
               </div>
           </div>
       </div>
       <div class="footer">
          <div class="last" @click="liang(index)" v-for="(item,index) in list2" :key="index" :class="{active:index==currentindex}">
             <span>{{item.id}}</span>
          </div>
       </div>
    </div>
  </template>
  <script>
  import {bao} from '../../api/index.js'
  import pic7 from '../../assets/assets/pic7.jpg'
  export default {
      data(){
  
        return{
          currentindex:1,
          zt:"马上抢",
              pic7,
          list2:[
            {
              id:'首页'
            },
            {
              id:'抱抱团'
            },
            {
              id:'订单'
            },
            {
              id:'我的'
            },
          ],
          list3:[
  
          ]
        }
      },
      methods:{
        jiupin(){
          bao({status:0}).then((res)=>{
          console.log(res.data.list)
          this.list3=res.data.list
      })
        },
        masq(){
          this.zt='已抢'
        },
        liang(index){
          this.currentindex=index
        },
        xinpin(){
          bao({status:1}).then((res)=>{
          console.log(res.data.list)
          this.list3=res.data.list
      })
        },
      },
      mounted(){
        bao({status:0}).then((res)=>{
          console.log(res.data.list)
          this.list3=res.data.list
      })
      }
  }
  </script>
  
  <style scoped>
  .banner{
    width: 100%;
  }
  .banner img{
    width: 100%;
    height: 150px;
  }
  .nav{
    height: 50px;
    background-color: orangered;
    line-height: 50px;
  }
  .nav span{
    font-weight: 700;
    color: white;
    margin-right: 20px;
    padding-left: 15px;
  }
  .content{
    flex: 1;
    height: 400px;
    overflow: auto;
    padding:10px 20px;
    background-color: rgba(128, 128, 128, 0.075);
  }
  .content .good{
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 10px;
    width: 100%;
    height: 130px;
    box-sizing: border-box;
    overflow: hidden;
    border-radius: 5px;
    background-color: white;
    display: flex;
  }
  .good img{
    width: 110px;
    height: 110px;
  }
  .good .price{
    display: flex;
    justify-content: space-between;
  }
  .good .price .key{
    display: flex;
    justify-content: space-between;
  }
  .good .money{
    justify-content: space-between;
    display: flex;
  }
  .good .right{
    line-height: 18px;
    margin-left: 10px;
  }
  .good .right .id{
    font-size: 12px;
    color: rgba(128, 128, 128, 0.888);
  }
  .good .right .desc{
    font-weight: 700;
  }
  .good .right .bao{
    color: orangered;
    font-size: 12px;
  }
  .good .right .price .one{
    margin-right: 5px;
    color: orangered;
    font-weight: 700;
  }
  .good .right .price .two{
    margin-right: 50px;
    color: orangered;
    width: 100%;
    height: 18px;
    text-align: center;
    line-height: 18px;
    border: 1px solid orangered;
  }
  .good .right .price .three{
    background-color: orangered;
    color: white;
    text-align: center;
    line-height: 25px;
    width: 60px;
    height: 25px;
    font-size: 14px;
    border-radius: 10px;
  }
  .good .right .money .yi{
    text-decoration:line-through;
    color: gray;
    font-size: 12px;
    
  }
  .good .right .money .er{
    color: orangered;
    font-size: 12px;
  }
  .footer{
    display: flex;
    justify-content: space-around;
    line-height: 70px;
    position: fixed;
    bottom: 0;
    width: 100%;
    height: 70px;
    background-color: white;
  }
  .footer .active{
    color: skyblue;
    font-weight: bold;
  }
  </style>